
// #ifndef VUE3
import Vue from 'vue'
import App from './App'
import store from 'store/index.js'
import util from 'config/util.js'
import Request from "config/TokenRequst.js"
import websocket from 'config/websocket.js'
import config from 'config/config.js'

Vue.config.productionTip = false

const onMessage = (data) => {
	//TODO:
	let message = JSON.parse(data)
	console.log("websocket收到消息:")
	console.log(message)
	store.commit("addMessage", message)
}

App.mpType = 'app'
let ws = new websocket("ws://"+config.url+"/ws", onMessage)
Vue.prototype.$socket = ws
Vue.prototype.$store = store
Vue.prototype.$request = Request
Vue.prototype.$util = util

const app = new Vue({
    ...App,
	store
})
app.$mount()
// #endif

import uView from '@/uni_modules/uview-ui'
Vue.use(uView)
uni.$u.config.unit = 'rpx'

// #ifdef VUE3
import { createSSRApp } from 'vue'
import App from './App.vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif